package com.shujia.ml

import org.apache.spark.ml.classification.LogisticRegressionModel
import org.apache.spark.ml.linalg.Vectors
import org.apache.spark.sql.SparkSession

object Demo4UsePersonMode {
  def main(args: Array[String]): Unit = {
    val spark: SparkSession = SparkSession
      .builder()
      .master("local")
      .appName("point")
      .getOrCreate()


    //1、加载模型
    val model: LogisticRegressionModel = LogisticRegressionModel.load("spark/data/person_model")

    /**
     * 1 1:6.1 2:4.3 3:3.7 4:142.9 5:104.2 6:83.3 7:55
     * 0 1:4.6 2:3.1 3:2.4 4:104.5 5:73.6 6:65.0 7:82
     */
    val y: Double = model.predict(Vectors.dense(6.1, 4.3, 3.7, 142.9, 104.2, 83.3, 55))
    println(y)

  }
}
